Comparing version 3.0.0-alpha.7 to 3.0.0-beta.1
@@ -5,4 +5,10 @@ # Changelog | ||
A list of unreleased changes can be found [here](https://github.com/SAP/ui5-fs/compare/v3.0.0-alpha.7...HEAD). | ||
A list of unreleased changes can be found [here](https://github.com/SAP/ui5-fs/compare/v3.0.0-beta.1...HEAD). | ||
<a name="v3.0.0-beta.1"></a> | ||
## [v3.0.0-beta.1] - 2022-11-07 | ||
### Bug Fixes | ||
- Allow resource migration ([#407](https://github.com/SAP/ui5-fs/issues/407)) [`1722d71`](https://github.com/SAP/ui5-fs/commit/1722d71b78184cae0dfb092fd3d4c4156924dc28) | ||
<a name="v3.0.0-alpha.7"></a> | ||
@@ -189,2 +195,3 @@ ## [v3.0.0-alpha.7] - 2022-10-24 | ||
[v3.0.0-beta.1]: https://github.com/SAP/ui5-fs/compare/v3.0.0-alpha.7...v3.0.0-beta.1 | ||
[v3.0.0-alpha.7]: https://github.com/SAP/ui5-fs/compare/v3.0.0-alpha.6...v3.0.0-alpha.7 | ||
@@ -191,0 +198,0 @@ [v3.0.0-alpha.6]: https://github.com/SAP/ui5-fs/compare/v3.0.0-alpha.5...v3.0.0-alpha.6 |
# Contributing to the UI5 Tooling | ||
See CONTRIBUTING.md in the [SAP/ui5-tooling](https://github.com/SAP/ui5-tooling/blob/master/CONTRIBUTING.md) repository. | ||
See CONTRIBUTING.md in the [SAP/ui5-tooling](https://github.com/SAP/ui5-tooling/blob/main/CONTRIBUTING.md) repository. |
@@ -188,19 +188,40 @@ import logger from "@ui5/logger"; | ||
_write(resource) { | ||
if (!this._project) { | ||
return; | ||
async _migrateResource(resource) { | ||
// Check if its a fs/Resource v3, function 'hasProject' was | ||
// introduced with v3 therefore take it as the indicator | ||
if (resource.hasProject) { | ||
return resource; | ||
} | ||
// Assign project to resource if necessary | ||
if (resource.hasProject()) { | ||
if (resource.getProject() !== this._project) { | ||
throw new Error( | ||
`Unable to write resource associated with project ` + | ||
`${resource.getProject().getName()} into adapter of project ${this._project.getName()}: ` + | ||
resource.getPath()); | ||
const options = { | ||
path: resource._path, | ||
statInfo: resource._statInfo, | ||
source: resource._source | ||
}; | ||
if (resource._stream) { | ||
options.buffer = await resource._getBufferFromStream(); | ||
} else if (resource._createStream) { | ||
options.createStream = resource._createStream; | ||
} else if (resource._buffer) { | ||
options.buffer = resource._buffer; | ||
} | ||
return new Resource(options); | ||
} | ||
_write(resource) { | ||
if (this._project) { | ||
// Assign project to resource if necessary | ||
if (resource.hasProject()) { | ||
if (resource.getProject() !== this._project) { | ||
throw new Error( | ||
`Unable to write resource associated with project ` + | ||
`${resource.getProject().getName()} into adapter of project ${this._project.getName()}: ` + | ||
resource.getPath()); | ||
} | ||
return; | ||
} | ||
return; | ||
log.silly(`Associating resource ${resource.getPath()} with project ${this._project.getName()}`); | ||
resource.setProject(this._project); | ||
} | ||
log.silly(`Associating resource ${resource.getPath()} with project ${this._project.getName()}`); | ||
resource.setProject(this._project); | ||
} | ||
@@ -207,0 +228,0 @@ } |
@@ -8,3 +8,3 @@ import logger from "@ui5/logger"; | ||
const chmod = promisify(fs.chmod); | ||
import globby from "globby"; | ||
import {globby} from "globby"; | ||
import makeDir from "make-dir"; | ||
@@ -213,2 +213,3 @@ import {PassThrough} from "node:stream"; | ||
async _write(resource, {drain, readOnly}) { | ||
resource = await this._migrateResource(resource); | ||
super._write(resource); | ||
@@ -215,0 +216,0 @@ if (drain && readOnly) { |
@@ -119,3 +119,4 @@ import logger from "@ui5/logger"; | ||
*/ | ||
_write(resource) { | ||
async _write(resource) { | ||
resource = await this._migrateResource(resource); | ||
super._write(resource); | ||
@@ -122,0 +123,0 @@ return new Promise((resolve, reject) => { |
@@ -82,3 +82,3 @@ function toPosix(inputPath) { | ||
const files = resources.map((resource) => { | ||
return resource._name; | ||
return resource.getName(); | ||
}); | ||
@@ -85,0 +85,0 @@ callback(null, files); |
@@ -56,3 +56,3 @@ import stream from "node:stream"; | ||
this._path = path; | ||
this._name = this._getNameFromPath(path); | ||
this._name = Resource._getNameFromPath(path); | ||
@@ -98,2 +98,6 @@ this._source = source; // Experimental, internal parameter | ||
static _getNameFromPath(virPath) { | ||
return path.posix.basename(virPath); | ||
} | ||
/** | ||
@@ -249,6 +253,16 @@ * Gets a buffer with the resource content. | ||
this._path = path; | ||
this._name = this._getNameFromPath(path); | ||
this._name = Resource._getNameFromPath(path); | ||
} | ||
/** | ||
* Gets the resource name | ||
* | ||
* @public | ||
* @returns {string} Name of the resource | ||
*/ | ||
getName() { | ||
return this._name; | ||
} | ||
/** | ||
* Gets the resources stat info. | ||
@@ -282,6 +296,2 @@ * Note that a resources stat information is not updated when the resource is being modified. | ||
_getNameFromPath(virPath) { | ||
return path.posix.basename(virPath); | ||
} | ||
/** | ||
@@ -288,0 +298,0 @@ * Adds a resource collection name that was involved in locating this resource. |
@@ -0,3 +1,5 @@ | ||
import Resource from "./Resource.js"; | ||
/** | ||
* A [Resource]{@ui5/project.Resource} with a different path than it's original | ||
* A {@link @ui5/fs/Resource Resource} with a different path than it's original | ||
* | ||
@@ -25,2 +27,3 @@ * @public | ||
this._path = path; | ||
this._name = Resource._getNameFromPath(path); | ||
this._resource = resource; | ||
@@ -40,2 +43,12 @@ } | ||
/** | ||
* Gets the resource name | ||
* | ||
* @public | ||
* @returns {string} Name of the resource | ||
*/ | ||
getName() { | ||
return this._name; | ||
} | ||
/** | ||
* Sets the resources path | ||
@@ -42,0 +55,0 @@ * |
{ | ||
"name": "@ui5/fs", | ||
"version": "3.0.0-alpha.7", | ||
"version": "3.0.0-beta.1", | ||
"description": "UI5 Tooling - File System Abstraction", | ||
@@ -123,16 +123,16 @@ "author": { | ||
"dependencies": { | ||
"@ui5/logger": "^3.0.1-alpha.3", | ||
"@ui5/logger": "^3.0.0-beta.1", | ||
"clone": "^2.1.0", | ||
"escape-string-regexp": "^4.0.0", | ||
"globby": "^11.1.0", | ||
"escape-string-regexp": "^5.0.0", | ||
"globby": "^13.1.2", | ||
"graceful-fs": "^4.2.9", | ||
"make-dir": "^3.1.0", | ||
"micromatch": "^4.0.4", | ||
"minimatch": "^3.0.3", | ||
"minimatch": "^5.1.0", | ||
"pretty-hrtime": "^1.0.3", | ||
"random-int": "^2.0.1" | ||
"random-int": "^3.0.0" | ||
}, | ||
"devDependencies": { | ||
"@istanbuljs/esm-loader-hook": "^0.2.0", | ||
"ava": "^4.3.3", | ||
"ava": "^5.0.1", | ||
"chai": "^4.3.4", | ||
@@ -144,12 +144,12 @@ "chai-fs": "^2.0.0", | ||
"docdash": "^1.2.0", | ||
"eslint": "^8.7.0", | ||
"eslint": "^8.26.0", | ||
"eslint-config-google": "^0.14.0", | ||
"eslint-plugin-ava": "^13.2.0", | ||
"eslint-plugin-jsdoc": "^37.6.3", | ||
"esmock": "^2.0.0", | ||
"esmock": "^2.0.7", | ||
"jsdoc": "^3.6.7", | ||
"nyc": "^15.1.0", | ||
"open-cli": "^6.0.1", | ||
"open-cli": "^7.1.0", | ||
"rimraf": "^3.0.2", | ||
"sinon": "^14.0.0", | ||
"sinon": "^14.0.1", | ||
"tap-nyan": "^1.1.0", | ||
@@ -156,0 +156,0 @@ "tap-xunit": "^2.4.1" |
@@ -1,2 +0,2 @@ | ||
![UI5 icon](https://raw.githubusercontent.com/SAP/ui5-tooling/master/docs/images/UI5_logo_wide.png) | ||
![UI5 icon](https://raw.githubusercontent.com/SAP/ui5-tooling/main/docs/images/UI5_logo_wide.png) | ||
@@ -8,3 +8,3 @@ # ui5-fs | ||
[![REUSE status](https://api.reuse.software/badge/github.com/SAP/ui5-fs)](https://api.reuse.software/info/github.com/SAP/ui5-fs) | ||
[![Build Status](https://dev.azure.com/sap/opensource/_apis/build/status/SAP.ui5-fs?branchName=master)](https://dev.azure.com/sap/opensource/_build/latest?definitionId=36&branchName=master) | ||
[![Build Status](https://dev.azure.com/sap/opensource/_apis/build/status/SAP.ui5-fs?branchName=main)](https://dev.azure.com/sap/opensource/_build/latest?definitionId=36&branchName=main) | ||
[![npm Package Version](https://badge.fury.io/js/%40ui5%2Ffs.svg)](https://www.npmjs.com/package/@ui5/fs) | ||
@@ -52,6 +52,6 @@ [![Coverage Status](https://coveralls.io/repos/github/SAP/ui5-fs/badge.svg)](https://coveralls.io/github/SAP/ui5-fs) | ||
## Contributing | ||
Please check our [Contribution Guidelines](https://github.com/SAP/ui5-tooling/blob/master/CONTRIBUTING.md). | ||
Please check our [Contribution Guidelines](https://github.com/SAP/ui5-tooling/blob/main/CONTRIBUTING.md). | ||
## Support | ||
Please follow our [Contribution Guidelines](https://github.com/SAP/ui5-tooling/blob/master/CONTRIBUTING.md#report-an-issue) on how to report an issue. | ||
Please follow our [Contribution Guidelines](https://github.com/SAP/ui5-tooling/blob/main/CONTRIBUTING.md#report-an-issue) on how to report an issue. | ||
@@ -58,0 +58,0 @@ Please report issues in the main [UI5 Tooling](https://github.com/SAP/ui5-tooling) repository. |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
125047
2717
+ Added@ui5/logger@3.0.0(transitive)
+ Addedbrace-expansion@2.0.1(transitive)
+ Addedglobby@13.2.2(transitive)
+ Addedminimatch@5.1.6(transitive)
+ Addedrandom-int@3.0.0(transitive)
+ Addedslash@4.0.0(transitive)
- Removed@ui5/logger@3.0.1-rc.3(transitive)
- Removedarray-union@2.1.0(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removedescape-string-regexp@4.0.0(transitive)
- Removedglobby@11.1.0(transitive)
- Removedminimatch@3.1.2(transitive)
- Removedrandom-int@2.0.1(transitive)
- Removedslash@3.0.0(transitive)
Updated@ui5/logger@^3.0.0-beta.1
Updatedescape-string-regexp@^5.0.0
Updatedglobby@^13.1.2
Updatedminimatch@^5.1.0
Updatedrandom-int@^3.0.0