mirror of
https://github.com/logto-io/logto.git
synced 2024-12-16 20:26:19 -05:00
fix: alteration script in dev
This commit is contained in:
parent
ac38a7f3ac
commit
9ebb3ddfd9
7 changed files with 10 additions and 10 deletions
|
@ -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",
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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(() => {
|
||||
|
|
|
@ -38,7 +38,7 @@ const importAlterationScript = async (filePath: string): Promise<AlterationScrip
|
|||
};
|
||||
|
||||
export const getAlterationFiles = async (): Promise<AlterationFile[]> => {
|
||||
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);
|
||||
|
|
4
packages/schemas/.gitignore
vendored
4
packages/schemas/.gitignore
vendored
|
@ -1,4 +1,2 @@
|
|||
/src/db-entries
|
||||
/alterations/*.d.ts
|
||||
/alterations/*.js
|
||||
/alterations/*.tsbuildinfo
|
||||
/alterations-js
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"extends": "./tsconfig",
|
||||
"compilerOptions": {
|
||||
"outDir": "alterations",
|
||||
"outDir": "alterations-js",
|
||||
},
|
||||
"include": ["alterations"],
|
||||
"exclude": []
|
||||
|
|
Loading…
Reference in a new issue