particle-commands 0.5.0 → 0.5.2

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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@
3
3
  The format is based on [Keep a Changelog](http://keepachangelog.com/)
4
4
  and this project adheres to [Semantic Versioning](http://semver.org/).
5
5
 
6
+ ### 0.5.2 - 2023-10-17
7
+ - Fix asset ota key in project properties file
8
+
9
+ ### 0.5.1 - 2023-10-11
10
+ - Fix gitignore file
11
+
6
12
  ### 0.5.0 - 2023-10-10
7
13
  - Add the new Particle project template
8
14
 
@@ -296,7 +296,7 @@ var ProjectInitCommand = exports.ProjectInitCommand = function (_Command) {
296
296
  var properties = { name: name };
297
297
  var project = new _project_properties2.default(directory, { fs: _project_properties2.default.buildFs(fs) });
298
298
  return this.createNotifyDirectory(site, fs, directory).then(function () {
299
- return _this6.createNotifyTemplateIfNeeded(site, fs, _path2.default.join(directory, '.gitignore'), '.gitignore', properties);
299
+ return _this6.createNotifyTemplateIfNeeded(site, fs, _path2.default.join(directory, '.gitignore'), 'gitignorefile', properties);
300
300
  }).then(function () {
301
301
  return _this6.createNotifyFileIfNeeded(site, fs, _path2.default.join(directory, 'project.properties'), '');
302
302
  }).then(function () {
@@ -123,17 +123,24 @@ var ProjectProperties = function () {
123
123
  }, {
124
124
  key: 'writeAssetOtaDir',
125
125
  value: function writeAssetOtaDir() {
126
- // Add a commented line for assetOtaDir
127
- var data = '#assetOtaDir=assets\n';
128
- return this.fs.appendFile(this.name(), data, 'utf8');
126
+ var _this3 = this;
127
+
128
+ // // Add a commented line for assetOtaDir if it doesn't exist
129
+ this.load().then(function () {
130
+ var val = _this3.getField('#assetOtaDir');
131
+ if (!val) {
132
+ _this3.setField('#assetOtaDir', 'assets');
133
+ return _this3.save();
134
+ }
135
+ });
129
136
  }
130
137
  }, {
131
138
  key: 'serialize',
132
139
  value: function serialize() {
133
- var _this3 = this;
140
+ var _this4 = this;
134
141
 
135
142
  return Object.keys(this.fields).map(function (field) {
136
- return field + '=' + _this3.fields[field];
143
+ return field + '=' + _this4.fields[field];
137
144
  }).join('\n') + '\n';
138
145
  }
139
146
  }, {
@@ -162,11 +169,11 @@ var ProjectProperties = function () {
162
169
  }, {
163
170
  key: 'projectLayout',
164
171
  value: function projectLayout() {
165
- var _this4 = this;
172
+ var _this5 = this;
166
173
 
167
174
  return this.exists().then(function (exists) {
168
175
  if (exists) {
169
- return _this4.sourceDirExists().then(function (exists) {
176
+ return _this5.sourceDirExists().then(function (exists) {
170
177
  return exists ? extended : simple;
171
178
  });
172
179
  } else {
@@ -0,0 +1,55 @@
1
+ # Key files
2
+ *.der
3
+ *.pem
4
+
5
+ # Ignore build results and bundles
6
+ *.bin
7
+ *.zip
8
+ [Dd]ebug/
9
+ [Dd]ebugPublic/
10
+ [Rr]elease/
11
+ [Rr]eleases/
12
+ [Bb]in/
13
+ [Oo]bj/
14
+ [Ll]og/
15
+ [Ll]ogs/
16
+ target/*
17
+
18
+ # Platform-specific settings
19
+ .DS_Store
20
+ *.crc_block
21
+ *.no_crc
22
+
23
+ # VisualStudioCode
24
+ .vscode/*
25
+ !.vscode/settings.json
26
+ !.vscode/tasks.json
27
+ !.vscode/launch.json
28
+ !.vscode/extensions.json
29
+ *.code-workspace
30
+
31
+ # Ignore all local history of files
32
+ **/.history
33
+
34
+ # Windows
35
+ Thumbs.db
36
+ *.stackdump
37
+ [Dd]esktop.ini
38
+
39
+ # C Prerequisites
40
+ *.d
41
+
42
+ # C Object files
43
+ *.o
44
+ *.ko
45
+ *.obj
46
+ *.elf
47
+
48
+ # C Linker output
49
+ *.map
50
+
51
+ # C Debug files
52
+ *.dSYM/
53
+ *.su
54
+ *.idb
55
+ *.pdb
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "particle-commands",
3
3
  "description": "Library of UX-neutral commands that provide key functionality for developer tools",
4
- "version": "0.5.0",
4
+ "version": "0.5.2",
5
5
  "author": "Matthew McGowan",
6
6
  "bugs": {
7
7
  "url": "https://github.com/particle-iot/particle-commands/issues"
@@ -76,7 +76,7 @@
76
76
  "version": "npm run update-changelog",
77
77
  "compile": "npm run compile:src && npm run copy:dotfiles",
78
78
  "compile:src": "babel src -d dist --copy-files",
79
- "copy:dotfiles": "copyfiles -u 4 src/cmd/templates/project/.github/**/* src/cmd/templates/project/.gitignore dist/cmd/templates/project/",
79
+ "copy:dotfiles": "copyfiles -u 4 src/cmd/templates/project/.github/**/* dist/cmd/templates/project/",
80
80
  "babel-watch": "babel src -d dist --watch --source-maps --copy-files",
81
81
  "doctoc": "doctoc --title '## Table of Contents' README.md",
82
82
  "list-folders": "node --require babel-register bin/list_folders.js",
@@ -210,7 +210,7 @@ export class ProjectInitCommand extends Command {
210
210
  const properties = { name };
211
211
  const project = new ProjectProperties(directory, { fs:ProjectProperties.buildFs(fs) });
212
212
  return this.createNotifyDirectory(site, fs, directory)
213
- .then(() => this.createNotifyTemplateIfNeeded(site, fs, path.join(directory, '.gitignore'), '.gitignore', properties))
213
+ .then(() => this.createNotifyTemplateIfNeeded(site, fs, path.join(directory, '.gitignore'), 'gitignorefile', properties))
214
214
  .then(() => this.createNotifyFileIfNeeded(site, fs, path.join(directory, 'project.properties'), ''))
215
215
  .then(() => this.createNotifyDirectory(site, fs, path.join(directory, 'src')))
216
216
  .then(() => this.createNotifyDirectory(site, fs, path.join(directory, '.github', 'workflows')))
@@ -73,9 +73,15 @@ export default class ProjectProperties {
73
73
  }
74
74
 
75
75
  writeAssetOtaDir() {
76
- // Add a commented line for assetOtaDir
77
- const data = '#assetOtaDir=assets\n';
78
- return this.fs.appendFile(this.name(), data, 'utf8');
76
+ // // Add a commented line for assetOtaDir if it doesn't exist
77
+ this.load()
78
+ .then(() => {
79
+ const val = this.getField('#assetOtaDir');
80
+ if (!val) {
81
+ this.setField('#assetOtaDir', 'assets');
82
+ return this.save();
83
+ }
84
+ });
79
85
  }
80
86
 
81
87
  serialize() {
@@ -0,0 +1,55 @@
1
+ # Key files
2
+ *.der
3
+ *.pem
4
+
5
+ # Ignore build results and bundles
6
+ *.bin
7
+ *.zip
8
+ [Dd]ebug/
9
+ [Dd]ebugPublic/
10
+ [Rr]elease/
11
+ [Rr]eleases/
12
+ [Bb]in/
13
+ [Oo]bj/
14
+ [Ll]og/
15
+ [Ll]ogs/
16
+ target/*
17
+
18
+ # Platform-specific settings
19
+ .DS_Store
20
+ *.crc_block
21
+ *.no_crc
22
+
23
+ # VisualStudioCode
24
+ .vscode/*
25
+ !.vscode/settings.json
26
+ !.vscode/tasks.json
27
+ !.vscode/launch.json
28
+ !.vscode/extensions.json
29
+ *.code-workspace
30
+
31
+ # Ignore all local history of files
32
+ **/.history
33
+
34
+ # Windows
35
+ Thumbs.db
36
+ *.stackdump
37
+ [Dd]esktop.ini
38
+
39
+ # C Prerequisites
40
+ *.d
41
+
42
+ # C Object files
43
+ *.o
44
+ *.ko
45
+ *.obj
46
+ *.elf
47
+
48
+ # C Linker output
49
+ *.map
50
+
51
+ # C Debug files
52
+ *.dSYM/
53
+ *.su
54
+ *.idb
55
+ *.pdb
@@ -16,7 +16,7 @@ describe('project_init', () => {
16
16
 
17
17
  beforeEach(() => {
18
18
  const fs = {};
19
- addFile(fs, ProjectInitCommand.templateFile('.gitignore'));
19
+ addFile(fs, ProjectInitCommand.templateFile('gitignorefile'));
20
20
  addFile(fs, ProjectInitCommand.templateFile('README.md'));
21
21
  addFile(fs, ProjectInitCommand.templateFile('src/project.cpp'));
22
22
  addFile(fs, ProjectInitCommand.templateFile('.github/workflows/main.yaml'));
@@ -51,7 +51,7 @@ describe('project_init', () => {
51
51
  expect(fs.existsSync(directory), 'expected project directory to exist').to.be.true;
52
52
  expect(fs.existsSync(path.join(directory, 'src')), 'expected src directory to exist').to.be.true;
53
53
  expect(fs.existsSync(path.join(directory, 'project.properties')), 'expected project.properties to exist').to.be.true;
54
- expectTemplate(path.join(directory, '.gitignore'), '.gitignore', properties);
54
+ expectTemplate(path.join(directory, '.gitignore'), 'gitignorefile', properties);
55
55
  expectTemplate(path.join(directory, '.github', 'workflows', 'main.yaml'), '.github/workflows/main.yaml', properties);
56
56
  expectTemplate(path.join(directory, 'README.md'), 'README.md', properties);
57
57
  expectTemplate(path.join(directory, 'src', properties.name+'.cpp'), 'src/project.cpp', properties);