Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ember data #16

Merged
merged 15 commits into from
Sep 27, 2023
  •  
  •  
  •  
68 changes: 59 additions & 9 deletions copy-entries.mjs
Original file line number Diff line number Diff line change
@@ -1,26 +1,76 @@
import { rmSync } from 'fs';
import { rmSync, readdirSync } from 'fs';

import fse from 'fs-extra';
import { program } from 'commander';
import { execa } from 'execa';
import semver from 'semver';
import cmp from 'semver-compare';

const { copySync } = fse;

program
.argument('project')
.argument('version');
.argument('[version]')
.option('-m, --min-version [version]');

program.parse();


const [project, version] = program.args;

const { minVersion } = program.opts();

const oldDocsPath = '/Users/mansona/temp/old-docs'


rmSync(`json-docs/${project}/${version}`, { recursive: true, force: true });
rmSync(`rev-index/${project}-${version}.json`);
if (version) {
// only apply for the specified version
copyEntries(project, version);
} else {
// do all versions
const fullProjectVersions = readdirSync(
`${oldDocsPath}/json-docs/${project}`
).filter((v) => v.match(/\d+\.\d+\.\d+/));

const projectVersions = fullProjectVersions.map((v) => {
let [, major, minor] = v.match(/(\d+)\.(\d+)\.\d+/);
return `${major}.${minor}`;
});

const uniqueProjectVersions = [...new Set(projectVersions)];
const highestPatchVersions = uniqueProjectVersions.map((uniqVersion) => {
const sortedPatchVersions = fullProjectVersions
.filter((projectVersion) => {
return semver.satisfies(projectVersion, uniqVersion);
})
.sort(cmp);

return sortedPatchVersions[sortedPatchVersions.length - 1];
})
.sort(cmp)
.filter((version) => {
if (minVersion) {
return semver.gte(version, minVersion);
} else {
return true;
}
});

copySync(`/Users/mansona/temp/old-docs/json-docs/${project}/${version}`, `./json-docs/${project}/${version}`, {recursive: true});
copySync(`/Users/mansona/temp/old-docs/rev-index/${project}-${version}.json`, `./rev-index/${project}-${version}.json`);
for (let version of highestPatchVersions) {
await copyEntries(project, version)
}
}

await execa('npm', ['run', 'fix:files'], { stdio: 'inherit'});
await execa('npm', ['run', 'test'], { stdio: 'inherit'});
async function copyEntries(project, version) {
rmSync(`json-docs/${project}/${version}`, { recursive: true, force: true });
try {
rmSync(`rev-index/${project}-${version}.json`);
} catch {
// ignore
}

copySync(`${oldDocsPath}/json-docs/${project}/${version}`, `./json-docs/${project}/${version}`, {recursive: true});
copySync(`${oldDocsPath}/rev-index/${project}-${version}.json`, `./rev-index/${project}-${version}.json`);

await execa('npm', ['run', 'fix:files'], { stdio: 'inherit'});
await execa('npm', ['run', 'test'], { stdio: 'inherit'});
}

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,267 @@
{
"data": {
"id": "ember-data-1.13.16-DS.AdapterPopulatedRecordArray",
"type": "class",
"attributes": {
"name": "DS.AdapterPopulatedRecordArray",
"shortname": "DS.AdapterPopulatedRecordArray",
"classitems": [],
"plugins": [],
"extensions": [],
"plugin_for": [],
"extension_for": [],
"module": "ember-data",
"namespace": "DS",
"file": "packages/ember-data/lib/system/record-arrays/adapter-populated-record-array.js",
"line": 10,
"description": "<html><head></head><body><p>Represents an ordered list of records whose order and membership is\ndetermined by the adapter. For example, a query sent to the adapter\nmay trigger a search on the server, whose results would be loaded\ninto an instance of the <code>AdapterPopulatedRecordArray</code>.</p>\n</body></html>",
"extends": "DS.RecordArray",
"methods": [
{
"file": "packages/ember-data/lib/system/record-arrays/adapter-populated-record-array.js",
"line": 28,
"itemtype": "method",
"name": "load",
"access": "private",
"tagname": "",
"params": [
{
"name": "data",
"description": "",
"type": "Array"
}
],
"class": "DS.AdapterPopulatedRecordArray",
"module": "ember-data",
"namespace": "DS"
},
{
"file": "packages/ember-data/lib/system/record-arrays/adapter-populated-record-array.js",
"line": 42,
"itemtype": "method",
"name": "loadRecords",
"params": [
{
"name": "records",
"description": "",
"type": "Array"
}
],
"access": "private",
"tagname": "",
"class": "DS.AdapterPopulatedRecordArray",
"module": "ember-data",
"namespace": "DS"
},
{
"file": "packages/ember-data/lib/system/record-arrays/record-array.js",
"line": 85,
"description": "<html><head></head><body><p>Retrieves an object from the content by index.</p>\n</body></html>",
"itemtype": "method",
"name": "objectAtContent",
"access": "private",
"tagname": "",
"params": [
{
"name": "index",
"description": "",
"type": "Number"
}
],
"return": {
"description": "record",
"type": "DS.Model"
},
"class": "DS.AdapterPopulatedRecordArray",
"module": "ember-data",
"namespace": "DS",
"inherited": true,
"inheritedFrom": "DS.RecordArray"
},
{
"file": "packages/ember-data/lib/system/record-arrays/record-array.js",
"line": 99,
"description": "<html><head></head><body><p>Used to get the latest version of all of the records in this array\nfrom the adapter.</p>\n<p>Example</p>\n<div class=\"highlight javascript\">\n <div class=\"ribbon\"></div>\n <div class=\"scroller\">\n <table class=\"CodeRay\">\n <tbody>\n <tr>\n <td class=\"line-numbers\"><pre>1\n2\n3\n4\n</pre></td>\n <td class=\"code\"><pre><span class=\"keyword\">var</span> people = store.peekAll(<span class=\"string\">&apos;person&apos;</span>);\npeople.<span class=\"keyword\">get</span>(<span class=\"string\">&apos;isUpdating&apos;</span>); <span class=\"comment\">// false</span>\npeople.update();\npeople.<span class=\"keyword\">get</span>(<span class=\"string\">&apos;isUpdating&apos;</span>); <span class=\"comment\">// true</span></pre></td>\n </tr>\n </tbody>\n </table>\n </div>\n </div>\n \n</body></html>",
"itemtype": "method",
"name": "update",
"class": "DS.AdapterPopulatedRecordArray",
"module": "ember-data",
"namespace": "DS",
"inherited": true,
"inheritedFrom": "DS.RecordArray"
},
{
"file": "packages/ember-data/lib/system/record-arrays/record-array.js",
"line": 123,
"description": "<html><head></head><body><p>Adds an internal model to the <code>RecordArray</code> without duplicates</p>\n</body></html>",
"itemtype": "method",
"name": "addInternalModel",
"access": "private",
"tagname": "",
"params": [
{
"name": "internalModel",
"description": "",
"type": "InternalModel"
},
{
"name": "an",
"description": "optional index to insert at",
"type": "Number"
}
],
"class": "DS.AdapterPopulatedRecordArray",
"module": "ember-data",
"namespace": "DS",
"inherited": true,
"inheritedFrom": "DS.RecordArray"
},
{
"file": "packages/ember-data/lib/system/record-arrays/record-array.js",
"line": 140,
"description": "<html><head></head><body><p>Removes an internalModel to the <code>RecordArray</code>.</p>\n</body></html>",
"itemtype": "method",
"name": "removeInternalModel",
"access": "private",
"tagname": "",
"params": [
{
"name": "internalModel",
"description": "",
"type": "InternalModel"
}
],
"class": "DS.AdapterPopulatedRecordArray",
"module": "ember-data",
"namespace": "DS",
"inherited": true,
"inheritedFrom": "DS.RecordArray"
},
{
"file": "packages/ember-data/lib/system/record-arrays/record-array.js",
"line": 151,
"description": "<html><head></head><body><p>Saves all of the records in the <code>RecordArray</code>.</p>\n<p>Example</p>\n<div class=\"highlight javascript\">\n <div class=\"ribbon\"></div>\n <div class=\"scroller\">\n <table class=\"CodeRay\">\n <tbody>\n <tr>\n <td class=\"line-numbers\"><pre>1\n2\n3\n4\n5\n</pre></td>\n <td class=\"code\"><pre>var messages = store.peekAll(&apos;<span class=\"keyword\">message</span>&apos;);\nmessages.<span class=\"keyword\">forEach</span>(<span class=\"keyword\">function</span>(<span class=\"keyword\">message</span>) {\n <span class=\"keyword\">message</span>.<span class=\"keyword\">set</span>(&apos;hasBeenSeen&apos;, <span class=\"keyword\">true</span>);\n});\nmessages.save();</pre></td>\n </tr>\n </tbody>\n </table>\n </div>\n </div>\n \n</body></html>",
"itemtype": "method",
"name": "save",
"return": {
"description": "promise",
"type": "DS.PromiseArray"
},
"class": "DS.AdapterPopulatedRecordArray",
"module": "ember-data",
"namespace": "DS",
"inherited": true,
"inheritedFrom": "DS.RecordArray"
},
{
"file": "packages/ember-data/lib/system/record-arrays/record-array.js",
"line": 189,
"itemtype": "method",
"name": "_unregisterFromManager",
"access": "private",
"tagname": "",
"class": "DS.AdapterPopulatedRecordArray",
"module": "ember-data",
"namespace": "DS",
"inherited": true,
"inheritedFrom": "DS.RecordArray"
}
],
"events": [],
"properties": [
{
"file": "packages/ember-data/lib/system/record-arrays/record-array.js",
"line": 25,
"description": "<html><head></head><body><p>The model type contained by this record array.</p>\n</body></html>",
"itemtype": "property",
"name": "type",
"type": "DS.Model",
"class": "DS.AdapterPopulatedRecordArray",
"module": "ember-data",
"namespace": "DS",
"inherited": true,
"inheritedFrom": "DS.RecordArray"
},
{
"file": "packages/ember-data/lib/system/record-arrays/record-array.js",
"line": 33,
"description": "<html><head></head><body><p>The array of client ids backing the record array. When a\nrecord is requested from the record array, the record\nfor the client id at the same index is materialized, if\nnecessary, by the store.</p>\n</body></html>",
"itemtype": "property",
"name": "content",
"access": "private",
"tagname": "",
"type": "Ember.Array",
"class": "DS.AdapterPopulatedRecordArray",
"module": "ember-data",
"namespace": "DS",
"inherited": true,
"inheritedFrom": "DS.RecordArray"
},
{
"file": "packages/ember-data/lib/system/record-arrays/record-array.js",
"line": 45,
"description": "<html><head></head><body><p>The flag to signal a <code>RecordArray</code> is finished loading data.</p>\n<p>Example</p>\n<div class=\"highlight javascript\">\n <div class=\"ribbon\"></div>\n <div class=\"scroller\">\n <table class=\"CodeRay\">\n <tbody>\n <tr>\n <td class=\"line-numbers\"><pre>1\n2\n</pre></td>\n <td class=\"code\"><pre><span class=\"keyword\">var</span> people = store.peekAll(<span class=\"string\">&apos;person&apos;</span>);\npeople.<span class=\"keyword\">get</span>(<span class=\"string\">&apos;isLoaded&apos;</span>); <span class=\"comment\">// true</span></pre></td>\n </tr>\n </tbody>\n </table>\n </div>\n </div>\n \n</body></html>",
"itemtype": "property",
"name": "isLoaded",
"type": "Boolean",
"class": "DS.AdapterPopulatedRecordArray",
"module": "ember-data",
"namespace": "DS",
"inherited": true,
"inheritedFrom": "DS.RecordArray"
},
{
"file": "packages/ember-data/lib/system/record-arrays/record-array.js",
"line": 59,
"description": "<html><head></head><body><p>The flag to signal a <code>RecordArray</code> is currently loading data.</p>\n<p>Example</p>\n<div class=\"highlight javascript\">\n <div class=\"ribbon\"></div>\n <div class=\"scroller\">\n <table class=\"CodeRay\">\n <tbody>\n <tr>\n <td class=\"line-numbers\"><pre>1\n2\n3\n4\n</pre></td>\n <td class=\"code\"><pre><span class=\"keyword\">var</span> people = store.peekAll(<span class=\"string\">&apos;person&apos;</span>);\npeople.<span class=\"keyword\">get</span>(<span class=\"string\">&apos;isUpdating&apos;</span>); <span class=\"comment\">// false</span>\npeople.update();\npeople.<span class=\"keyword\">get</span>(<span class=\"string\">&apos;isUpdating&apos;</span>); <span class=\"comment\">// true</span></pre></td>\n </tr>\n </tbody>\n </table>\n </div>\n </div>\n \n</body></html>",
"itemtype": "property",
"name": "isUpdating",
"type": "Boolean",
"class": "DS.AdapterPopulatedRecordArray",
"module": "ember-data",
"namespace": "DS",
"inherited": true,
"inheritedFrom": "DS.RecordArray"
},
{
"file": "packages/ember-data/lib/system/record-arrays/record-array.js",
"line": 76,
"description": "<html><head></head><body><p>The store that created this record array.</p>\n</body></html>",
"itemtype": "property",
"name": "store",
"access": "private",
"tagname": "",
"type": "DS.Store",
"class": "DS.AdapterPopulatedRecordArray",
"module": "ember-data",
"namespace": "DS",
"inherited": true,
"inheritedFrom": "DS.RecordArray"
}
]
},
"relationships": {
"parent-class": {
"data": {
"id": "ember-data-1.13.16-DS.RecordArray",
"type": "class"
}
},
"descendants": {
"data": []
},
"module": {
"data": {
"id": "ember-data-1.13.16-ember-data",
"type": "module"
}
},
"project-version": {
"data": {
"id": "ember-data-1.13.16",
"type": "project-version"
}
}
}
}
}
Loading