Skip to content

Commit 74ea342

Browse files
committed
update_scignore_files_and_refactor_env_initialization_in_collections
- Add entries for 'test', '**/*.test.js', 'components', and 'README.md' to .scignore files in smart-collections, smart-entities, and smart-sources to improve ignore patterns. - Comment out direct assignment of 'env' in Collection and CollectionItem constructors, replacing it with a call to 'env.create_env_getter(this)' for better encapsulation. - Maintain existing comments and methods unrelated to the changes.
1 parent bb6ce5d commit 74ea342

7 files changed

Lines changed: 22 additions & 10 deletions

File tree

smart-collections/.scignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
node_modules
1+
node_modules
2+
test
3+
**/*.test.js
4+
components
5+
README.md

smart-collections/collection.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ export class Collection {
2929
* @param {boolean} [opts.prevent_load_on_init] - Whether to prevent loading items on initialization.
3030
*/
3131
constructor(env, opts = {}) {
32-
this.env = env;
32+
// this.env = env;
33+
env.create_env_getter(this);
3334
this.opts = opts;
3435
if (opts.collection_key) this.collection_key = opts.collection_key;
3536
this.env[this.collection_key] = this;

smart-collections/item.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ export class CollectionItem {
3030
* @param {Object|null} [data=null] - Initial data for the item.
3131
*/
3232
constructor(env, data = null) {
33-
this.env = env;
33+
// this.env = env;
34+
env.create_env_getter(this);
3435
this.config = this.env?.config;
3536
this.merge_defaults();
3637

smart-entities/.scignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
utils/
21
package.json
3-
test/
4-
components/
2+
test
3+
**/*.test.js
4+
components
55
README.md

smart-fs/adapters/node_fs.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,10 @@ export class NodeFsSmartFsAdapter {
293293
async write(rel_path, content) {
294294
// ensure parent folder exists
295295
const parent_folder = path.dirname(rel_path);
296-
if(!await this.exists(parent_folder)) await this.mkdir(parent_folder, { recursive: true });
296+
if(!await this.exists(parent_folder)){
297+
console.log('mkdir for write', parent_folder);
298+
await this.mkdir(parent_folder, { recursive: true });
299+
}
297300
return await this.writeFile(rel_path, content);
298301
}
299302

smart-sources/.scignore

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
utils/
21
package.json
3-
components/
2+
components
43
README.md
54
schema.js
65
test/old-tests (needs review)
@@ -9,4 +8,6 @@ markdown.test.js
98
sqlite.**
109
*.sqlite
1110
smart_block.js
12-
smart_blocks.js
11+
smart_blocks.js
12+
test
13+
**/*.test.js

smart-sources/smart_sources.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ export class SmartSources extends SmartEntities {
7070
// create new item
7171
const item = new this.item_type(this.env, { path: file_path });
7272
this.items[file_path] = item;
73+
item.queue_import();
74+
item.queue_load();
7375
return item;
7476
}
7577

0 commit comments

Comments
 (0)