Skip to content

Commit

Permalink
changed config no cjs required
Browse files Browse the repository at this point in the history
  • Loading branch information
yeasir01 committed Jan 28, 2024
1 parent fb1c3d4 commit 185c1d0
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 84 deletions.
38 changes: 19 additions & 19 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
name: CI

on:
push:
branches:
- "**"
push:
branches:
- "**"

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
cache: "npm"
- name: INSTALL PACKAGES
run: npm install --frozen-lockfile
- name: TYPECHECK
run: npm run type-check
- name: LINT
run: npm run lint
- name: BUILD/BUNDLE
run: npm run build
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
cache: "npm"
- name: INSTALL PACKAGES
run: npm install --frozen-lockfile
- name: TYPECHECK
run: npm run type-check
- name: LINT
run: npm run lint
- name: BUILD/BUNDLE
run: npm run build
58 changes: 29 additions & 29 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
name: Publish

on:
workflow_run:
workflows: [CI]
branches: [main]
types: [completed]
workflow_run:
workflows: [CI]
branches: [main]
types: [completed]

concurrency: ${{ github.workflow }}-${{ github.ref }}

permissions:
contents: write
pull-requests: write
contents: write
pull-requests: write

jobs:
publish:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
cache: "npm"
- name: SET NODE_ENV TO "Production"
run: echo "NODE_ENV=production" >> $GITHUB_ENV
- name: INSTALL PACKAGES - INCLUDE DEV
run: npm install --frozen-lockfile --include=dev
- name: BUILD/BUNDLE
run: npm run build
- name: CREATE VERSION & SETUP PULL REQUEST
id: changesets
uses: changesets/action@v1
with:
publish: npx changeset publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
publish:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
cache: "npm"
- name: SET NODE_ENV TO "Production"
run: echo "NODE_ENV=production" >> $GITHUB_ENV
- name: INSTALL PACKAGES - INCLUDE DEV
run: npm install --frozen-lockfile --include=dev
- name: BUILD/BUNDLE
run: npm run build
- name: CREATE VERSION & SETUP PULL REQUEST
id: changesets
uses: changesets/action@v1
with:
publish: npx changeset publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
18 changes: 9 additions & 9 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"cSpell.words": [
"bpac",
"CLIPART",
"DATETIME",
"iife",
"tsup"
],
"liveServer.settings": {
"file": "./test/browser/index.html",
"mount": [
["/", "./test/browser"]
]
},
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
"editor.formatOnSave": false
"editor.formatOnSave": false,
"liveServer.settings.file": "./tests/browser/index.html",
"liveServer.settings.mount": [
["/", "./tests/browser/"]
],
"files.eol": "\n",
"[github-actions-workflow]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
4 changes: 2 additions & 2 deletions src/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@ export const populateObjectsInTemplate = async (data: Data): Promise<boolean> =>
case ObjectTypes.Image:
await obj.SetData(0, value, 4);
break;
case ObjectTypes.Datetime:
case ObjectTypes.DateTime:
await obj.SetData(0, value);
break;
case ObjectTypes.Barcode:
await doc.SetBarcodeData(0, value);
break;
case ObjectTypes.Clipart:
case ObjectTypes.ClipArt:
await obj.SetData(0, value, 0);
break;
default:
Expand Down
4 changes: 2 additions & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ export enum ObjectTypes {
Text = 0,
Barcode = 1,
Image = 2,
Datetime = 3,
Clipart = 4,
DateTime = 3,
ClipArt = 4,
}
37 changes: 16 additions & 21 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,22 @@
{
"compilerOptions": {
"target": "ES2017", // Target modern browsers for compatibility
"module": "ESNext", // Use ES modules for modern module system
"strict": true, // Enable strict type-checking
"noImplicitAny": true, // Disallow implicit 'any' types
"esModuleInterop": true, // Enable seamless interoperability with CommonJS modules
"skipLibCheck": true, // Skip type checking of declaration files (for faster compilation)
"forceConsistentCasingInFileNames": true, // Enforce consistent file casing for compatibility
"resolveJsonModule": true, // Allow importing JSON files as modules
"allowSyntheticDefaultImports": true, // Allow default imports from modules with no default export
"target": "ES2017",
"module": "ESNext",
"strict": true,
"noImplicitAny": true,
"isolatedModules": true,
"noEmit": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"noImplicitReturns": true,
"allowImportingTsExtensions": true,
"isolatedModules": true, // Treat each file as a separate module (important for React)
"noEmit": true, //use tsup to emit & bundle
"noUncheckedIndexedAccess": true,
"moduleResolution": "Bundler", // Instructs the compiler to defer module resolution logic to a bundler, ensuring
// compatibility with tools like tsup
"allowJs": true, // Permits inclusion of JavaScript files within the project, enabling a gradual migration to TypeScript.
"checkJs": false, //Disables type checking for JavaScript files, focusing on TypeScript for type safety.
"lib": ["ES2017", "DOM", "DOM.Iterable"] //Includes additional libraries for DOM-related features and newer ECMAScript features,
//supporting web development scenarios.
"moduleResolution": "Bundler",
"allowJs": true,
"checkJs": false,
"lib": ["ES2017", "DOM", "DOM.Iterable"]
},
"include": ["src/**/*.ts", "src/**/*.js"], // Specifies the root directory and file pattern for inclusion in compilation,
// focusing on TypeScript files within the "src" directory.
"exclude": ["node_modules"] // Excludes the "node_modules" directory from compilation, avoiding redundant
// checks for external dependencies.
"include": ["src/**/*.ts", "src/**/*.js", "tests/*.spec.ts"],
"exclude": ["node_modules"]
}
4 changes: 2 additions & 2 deletions tsup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ const inDev = process.env.NODE_ENV !== "production";
const inProd = process.env.NODE_ENV === "production"

export default defineConfig({
entry: ["src/index.ts"],
entry: ["./src/index.ts"],
clean: true,
splitting: false,
sourcemap: inDev,
minify: inProd,
bundle: true,
format: ["esm", "cjs"],
format: ["esm"],
dts: true,
});

0 comments on commit 185c1d0

Please sign in to comment.