Skip to content

Commit

Permalink
Fixes to Create (#359)
Browse files Browse the repository at this point in the history
- Fix an issue where `create` would fail if `../../../..` wasn't in the
filesystem (for example, if running from `/tmp`).
- Set `.npmignore` for create so all template files are included
(`tsconfig.json` was excluded before)
- Alias the `dbos-sdk` command to `dbos`.
  • Loading branch information
kraftp authored Mar 25, 2024
1 parent 5f6f723 commit eb38cf9
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions examples/hello/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
testRegex: '((\\.|/)(test|spec))\\.ts?$',
testPathIgnorePatterns: ['examples/*'],
testPathIgnorePatterns: ['examples/*', 'packages/*'],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
modulePaths: ["./"],
collectCoverageFrom: [
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"test-fdb": "npm run --workspaces test && npx prisma generate --schema tests/prisma/schema.prisma && npm run build-fdb && jest --runInBand --coverage"
},
"bin": {
"dbos": "./dist/src/dbos-runtime/cli.js",
"dbos-sdk": "./dist/src/dbos-runtime/cli.js"
},
"devDependencies": {
Expand Down
8 changes: 7 additions & 1 deletion packages/create/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,10 @@ Gruntfile.js
tsconfig.json

# ignore any packed packages in the repo
*.tgz
*.tgz

# Include the templates code, but not node_modules or dist
!templates/**
templates/hello/.dbos
templates/hello/dist
templates/hello/node_modules
3 changes: 1 addition & 2 deletions packages/create/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,8 @@ export async function init(appName: string, templateName: string) {
const packageJson: { name: string } = JSON.parse(fs.readFileSync(packageJsonName, 'utf-8')) as { name: string };
packageJson.name = appName;
fs.writeFileSync(packageJsonName, JSON.stringify(packageJson, null, 2), 'utf-8');
execSync("npm ci --no-fund", {cwd: appName, stdio: 'inherit'})
execSync("npm uninstall --no-fund @dbos-inc/dbos-sdk", {cwd: appName, stdio: 'inherit'})
execSync("npm install --no-fund --save @dbos-inc/dbos-sdk@latest", {cwd: appName, stdio: 'inherit'})
execSync("npm ci --no-fund", {cwd: appName, stdio: 'inherit'})
execSync("npm install --no-fund --save-dev @dbos-inc/dbos-cloud@latest", {cwd: appName, stdio: 'inherit'})
console.log("Application initialized successfully!")
}

0 comments on commit eb38cf9

Please sign in to comment.