Skip to content

Commit

Permalink
Merge pull request #37 from IgniteUI/dTsvetkov/add-codesandbox-docker…
Browse files Browse the repository at this point in the history
…-config

Add codesandbox dockerfile config
  • Loading branch information
hanastasov authored Jun 7, 2023
2 parents 56501fa + 1ade345 commit 8c0d2e4
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 19 deletions.
3 changes: 3 additions & 0 deletions src/generators/SharedAssetsGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const ENVIRONMENT_FILE_PATH = path.join(__dirname, "../templates/environment.ts.
const ENVIRONMENT_PROD_FILE_PATH = path.join(__dirname, "../templates/environment.prod.ts.template");
const STACKBLITZ_CONFIG_FILE_PATH = path.join(__dirname, "../templates/stackblitzrc.template");
const CODESANDBOX_TASKS_FILE_PATH = path.join(__dirname, "../templates/tasks.json.template");
const CODESANDBOX_DOCKER_FILE_PATH = path.join(__dirname, "../templates/Dockerfile.template");
export class SharedAssetsGenerator {

constructor(private options: ILiveEditingOptions) {
Expand Down Expand Up @@ -49,6 +50,7 @@ export class SharedAssetsGenerator {
let tsConfigAppFile = fs.readFileSync(TS_APP_CONFIG_FILE_PATH, "utf8");
let stackblitzConfigFile = fs.readFileSync(STACKBLITZ_CONFIG_FILE_PATH, "utf8");
let codesandboxTasks= fs.readFileSync(CODESANDBOX_TASKS_FILE_PATH, "utf8");
let codesandboxDocker= fs.readFileSync(CODESANDBOX_DOCKER_FILE_PATH, "utf8");

if(this.options.additionalSharedStyles?.length) {
this.options.additionalSharedStyles.forEach(fileName => {
Expand All @@ -61,6 +63,7 @@ export class SharedAssetsGenerator {
files.push(new LiveEditingFile("tsconfig.app.json", tsConfigAppFile));
files.push(new LiveEditingFile(".stackblitzrc", stackblitzConfigFile));
files.push(new LiveEditingFile(".codesandbox/tasks.json", codesandboxTasks));
files.push(new LiveEditingFile(".codesandbox/Dockerfile", codesandboxDocker));
files.push(new LiveEditingFile(SAMPLE_ENVIRONMENTS_FOLDER + "environment.ts", environmentFile));
files.push(new LiveEditingFile(SAMPLE_ENVIRONMENTS_FOLDER + "environment.prod.ts", environmentProdFile));
}
Expand Down
1 change: 1 addition & 0 deletions src/templates/Dockerfile.template
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FROM node:18
5 changes: 4 additions & 1 deletion src/templates/angular.json.template
Original file line number Diff line number Diff line change
Expand Up @@ -103,5 +103,8 @@
}
}
},
"defaultProject": "example-app"
"defaultProject": "example-app",
"cli": {
"analytics": false
}
}
28 changes: 10 additions & 18 deletions src/templates/tasks.json.template
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,15 @@
"setupTasks": [
{
"name": "Install Dependencies",
"command": "npm i --legacy-peer-deps"
},
{
"name": "Install Angular Cli",
"command": "npm i @angular/cli --force"
},
{
"name": "Start Sample",
"command": "ng serve --disable-host-check"
"command": "yarn install"
}
],

// These tasks can be run from CodeSandbox. Running one will open a log in the app.
"tasks": {
"ng serve --disable-host-check": {
"name": "ng serve --disable-host-check",
"command": "ng serve --disable-host-check"
},
}
}
// These tasks can be run from CodeSandbox. Running one will open a log in the app.
"tasks": {
"node node_modules/@angular/cli/bin/ng serve -o --disable-host-check": {
"name": "Start Project",
"command": "node node_modules/@angular/cli/bin/ng serve -o --disable-host-check",
"runAtStart": true
}
}
}

0 comments on commit 8c0d2e4

Please sign in to comment.