@mbc-cqrs-serverless/cli 0.1.41-beta.0 → 0.1.43-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -44,6 +44,8 @@ async function newAction(name = '', options, command) {
44
44
  const infraGitignore = path_1.default.join(destDir, 'infra/gitignore');
45
45
  (0, fs_1.copyFileSync)(infraGitignore, path_1.default.join(destDir, 'infra/.gitignore'));
46
46
  (0, fs_1.unlinkSync)(infraGitignore);
47
+ // replace project_name in .env.local
48
+ updateEnvLocal(path_1.default.join(destDir, '.env.local'), '%%projectName%%', projectName);
47
49
  // cp .env.local .env
48
50
  (0, fs_1.copyFileSync)(path_1.default.join(destDir, '.env.local'), path_1.default.join(destDir, '.env'));
49
51
  // git init
@@ -96,10 +98,16 @@ function getPackageVersion(packageName, isLatest = false) {
96
98
  const versions = JSON.parse((0, child_process_1.execSync)(`npm view ${packageName} versions --json`).toString());
97
99
  return versions;
98
100
  }
101
+ function updateEnvLocal(envPath, searchValue, replaceValue) {
102
+ const envLocalContent = (0, fs_1.readFileSync)(envPath, 'utf8');
103
+ const newEnvLocalContent = envLocalContent.replaceAll(searchValue, replaceValue);
104
+ (0, fs_1.writeFileSync)(envPath, newEnvLocalContent);
105
+ }
99
106
  exports.exportsForTesting = {
100
107
  usePackageVersion,
101
108
  getPackageVersion,
102
109
  isLatestCli,
110
+ updateEnvLocal,
103
111
  };
104
112
  if (process.env.NODE_ENV !== 'test') {
105
113
  exports.exportsForTesting = undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mbc-cqrs-serverless/cli",
3
- "version": "0.1.41-beta.0",
3
+ "version": "0.1.43-beta.0",
4
4
  "description": "a CLI to get started with MBC CQRS serverless framework",
5
5
  "keywords": [
6
6
  "mbc",
@@ -49,5 +49,5 @@
49
49
  "devDependencies": {
50
50
  "@faker-js/faker": "^8.3.1"
51
51
  },
52
- "gitHead": "f07fa4ecbf2d4d97d39fd45ecd49f3ddf993d8fa"
52
+ "gitHead": "ba6fe38347775dddd091df2fe8b5a27e83006bd6"
53
53
  }
@@ -5,7 +5,9 @@ AWS_DEFAULT_REGION=ap-northeast-1
5
5
  # running environment
6
6
  NODE_ENV=local # local, dev, stg, prod
7
7
  # name of application
8
- APP_NAME=demo
8
+ APP_NAME=%%projectName%%
9
+ # name of docker compose
10
+ COMPOSE_PROJECT_NAME=%%projectName%%
9
11
  # set log levels
10
12
  LOG_LEVEL=verbose # debug, verbose, info, warn, error, fatal
11
13
  # disable event route for API GW integration
@@ -16,11 +16,11 @@
16
16
  "start:repl": "nest start --watch --entryFile repl",
17
17
  "start:prod": "node dist/main",
18
18
  "offline:docker:build": "run-script-os",
19
- "offline:docker:build:default": "cd infra-local && docker compose up --build --remove-orphans",
20
- "offline:docker:build:win32": "powershell -Command \"Set-Location infra-local; docker compose up --build --remove-orphans\"",
19
+ "offline:docker:build:default": "ln -f .env $PWD/infra-local/.env && cd infra-local && docker compose up --build --remove-orphans",
20
+ "offline:docker:build:win32": "powershell -Command \"Copy-Item '.env' -Destination './infra-local/.env'; Set-Location infra-local; docker compose up --build --remove-orphans\"",
21
21
  "offline:docker": "run-script-os",
22
- "offline:docker:default": "cd infra-local && mkdir -p docker-data/.cognito && cp -r cognito-local/db docker-data/.cognito && docker compose up --remove-orphans",
23
- "offline:docker:win32": "powershell -Command \"Set-Location infra-local; New-Item -ItemType Directory -Force -Path 'docker-data/.cognito'; Copy-Item -Recurse -Force 'cognito-local/db' 'docker-data/.cognito'; docker compose up --remove-orphans\"",
22
+ "offline:docker:default": "ln -f .env $PWD/infra-local/.env && cd infra-local && mkdir -p docker-data/.cognito && cp -r cognito-local/db docker-data/.cognito && docker compose up --remove-orphans",
23
+ "offline:docker:win32": "powershell -Command \"Copy-Item '.env' -Destination './infra-local/.env'; Set-Location infra-local; New-Item -ItemType Directory -Force -Path 'docker-data/.cognito'; Copy-Item -Recurse -Force 'cognito-local/db' 'docker-data/.cognito'; docker compose up --remove-orphans\"",
24
24
  "offline:sls": "run-script-os",
25
25
  "offline:sls:default": "/bin/bash ./infra-local/scripts/resources.sh && /bin/bash ./infra-local/scripts/trigger_ddb_stream.sh & ln -f .env $PWD/infra-local/.env && cd infra-local && NODE_ENV=development AWS_ACCESS_KEY_ID=DUMMYIDEXAMPLE AWS_SECRET_ACCESS_KEY=DUMMYEXAMPLEKEY SLS_DEBUG=* serverless offline start",
26
26
  "offline:sls:win32": "npm run resources:win32 && concurrently \"npm run trigger-ddb:win32\" \"npm run sls:win32\"",