diff --git a/package.json b/package.json index db8c7ab8c..af11b8a5c 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "version": "pnpm i --frozen-lockfile=false && git add pnpm-lock.yaml", "prepare": "if test \"$NODE_ENV\" != \"production\" && test \"$CI\" != \"true\" ; then husky install ; fi", "prepack": "pnpm -r prepack", - "dev": "pnpm -r prepack --incremental && pnpm start:dev", + "dev": "pnpm -r prepack && pnpm start:dev", "start:dev": "pnpm -r --parallel --filter=!@logto/integration-tests dev", "start": "cd packages/core && NODE_ENV=production node .", "cli": "logto", diff --git a/packages/cli/package.json b/packages/cli/package.json index d6b7c7630..b6e8b925d 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -21,6 +21,7 @@ "precommit": "lint-staged", "prepare:package-json": "node -p \"'export const packageJson = ' + JSON.stringify(require('./package.json'), undefined, 2) + ';'\" > src/package-json.ts", "build": "rimraf lib && pnpm prepare:package-json && tsc -p tsconfig.build.json", + "dev": "tsc -p tsconfig.build.json --watch --preserveWatchOutput --incremental", "start": "node .", "start:dev": "ts-node --files src/index.ts", "lint": "eslint --ext .ts src", diff --git a/packages/cli/src/commands/database/alteration/index.test.ts b/packages/cli/src/commands/database/alteration/index.test.ts index 4a2cc37bc..8ea61e772 100644 --- a/packages/cli/src/commands/database/alteration/index.test.ts +++ b/packages/cli/src/commands/database/alteration/index.test.ts @@ -15,9 +15,9 @@ const pool = createMockPool({ describe('getUndeployedAlterations()', () => { const files = Object.freeze([ - { filename: '1.0.0-1663923770-a.js', path: '/alterations/1.0.0-1663923770-a.js' }, - { filename: '1.0.0-1663923771-b.js', path: '/alterations/1.0.0-1663923771-b.js' }, - { filename: '1.0.0-1663923772-c.js', path: '/alterations/1.0.0-1663923772-c.js' }, + { filename: '1.0.0-1663923770-a.js', path: '/alterations-js/1.0.0-1663923770-a.js' }, + { filename: '1.0.0-1663923771-b.js', path: '/alterations-js/1.0.0-1663923771-b.js' }, + { filename: '1.0.0-1663923772-c.js', path: '/alterations-js/1.0.0-1663923772-c.js' }, ]); beforeEach(() => { diff --git a/packages/cli/src/commands/database/alteration/index.ts b/packages/cli/src/commands/database/alteration/index.ts index 6c45de635..5055e013d 100644 --- a/packages/cli/src/commands/database/alteration/index.ts +++ b/packages/cli/src/commands/database/alteration/index.ts @@ -38,7 +38,7 @@ const importAlterationScript = async (filePath: string): Promise => { - const alterationDirectory = getPathInModule('@logto/schemas', 'alterations'); + const alterationDirectory = getPathInModule('@logto/schemas', 'alterations-js'); /** * We copy all alteration scripts to the CLI package root directory, @@ -88,6 +88,7 @@ export const getLatestAlterationTimestamp = async () => { export const getUndeployedAlterations = async (pool: DatabasePool) => { const databaseTimestamp = await getCurrentDatabaseAlterationTimestamp(pool); + const files = await getAlterationFiles(); return files.filter(({ filename }) => getTimestampFromFilename(filename) > databaseTimestamp); diff --git a/packages/schemas/.gitignore b/packages/schemas/.gitignore index be7e542f8..edd76d6a2 100644 --- a/packages/schemas/.gitignore +++ b/packages/schemas/.gitignore @@ -1,4 +1,2 @@ /src/db-entries -/alterations/*.d.ts -/alterations/*.js -/alterations/*.tsbuildinfo +/alterations-js diff --git a/packages/schemas/package.json b/packages/schemas/package.json index b53715907..1d3c336a5 100644 --- a/packages/schemas/package.json +++ b/packages/schemas/package.json @@ -13,7 +13,7 @@ "precommit": "lint-staged", "version": "./update-next.sh && git add alterations/", "generate": "rm -rf src/db-entries && ts-node src/gen/index.ts && eslint \"src/db-entries/**\" --fix", - "build:alterations": "rm -rf alterations/*.d.ts alterations/*.js && tsc -p tsconfig.build.alterations.json", + "build:alterations": "rm -rf alterations-js && tsc -p tsconfig.build.alterations.json", "build": "pnpm generate && rm -rf lib/ && tsc -p tsconfig.build.json && pnpm build:alterations", "dev": "tsc -p tsconfig.build.json --watch --preserveWatchOutput --incremental", "lint": "eslint --ext .ts src", diff --git a/packages/schemas/tsconfig.build.alterations.json b/packages/schemas/tsconfig.build.alterations.json index 79097ebc4..96cde8fa1 100644 --- a/packages/schemas/tsconfig.build.alterations.json +++ b/packages/schemas/tsconfig.build.alterations.json @@ -1,7 +1,7 @@ { "extends": "./tsconfig", "compilerOptions": { - "outDir": "alterations", + "outDir": "alterations-js", }, "include": ["alterations"], "exclude": []