Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 37 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6

- name: Setup python 3.11
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: '3.11'

- name: Setup nodejs 20.x
uses: actions/setup-node@v4
- name: Setup nodejs 24
uses: actions/setup-node@v6
with:
node-version: 20.x
node-version: 24

- name: Install dependencies
run: |
Expand All @@ -37,6 +37,7 @@ jobs:
npm --prefix tasks/ReplaceTokensV4 ci
npm --prefix tasks/ReplaceTokensV5 ci
npm --prefix tasks/ReplaceTokensV6 ci
npm --prefix tasks/ReplaceTokensV7 ci

- name: Check code format
run: npm run format:check
Expand All @@ -56,14 +57,14 @@ jobs:
needs: build

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Setup python 3.11
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: '3.11'

- name: 'Hack: manual download of node6 (linux)'
- name: 'Hack: manual download of node (linux)'
if: runner.os == 'Linux'
run: |
mkdir -p $RUNNER_TEMP/node6/node-v6.17.1-linux-x64
Expand All @@ -73,30 +74,46 @@ jobs:
cp $RUNNER_TEMP/node6/node-v6.17.1-linux-x64/bin/node $HOME/azure-pipelines-task-lib/_download/node6/node-v6.17.1-linux-x64/bin
echo '' > $HOME/azure-pipelines-task-lib/_download/node6.completed

- name: 'Hack: manual download of node6 (macos)'
- name: 'Hack: manual download of node (macos)'
if: runner.os == 'macOS'
run: |
mkdir -p $RUNNER_TEMP/node6/node-v6.17.1-darwin-x64
curl https://nodejs.org/dist/v6.17.1/node-v6.17.1-darwin-x64.tar.gz -o $RUNNER_TEMP/node6/node-v6.17.1-darwin-x64.tar.gz
tar xz --strip 1 -C $RUNNER_TEMP/node6/node-v6.17.1-darwin-x64 -f $RUNNER_TEMP/node6/node-v6.17.1-darwin-x64.tar.gz
mkdir -p $HOME/azure-pipelines-task-lib/_download/node6/node-v6.17.1-darwin-x64/bin
cp $RUNNER_TEMP/node6/node-v6.17.1-darwin-x64/bin/node $HOME/azure-pipelines-task-lib/_download/node6/node-v6.17.1-darwin-x64/bin
rm -rf $HOME/azure-pipelines-task-lib/_download/node6
mkdir -p $HOME/azure-pipelines-task-lib/_download/node6
curl https://nodejs.org/dist/v6.17.1/node-v6.17.1-darwin-x64.tar.gz -o $HOME/azure-pipelines-task-lib/_download/node6/node.tar.gz
tar xz -C $HOME/azure-pipelines-task-lib/_download/node6 -f $HOME/azure-pipelines-task-lib/_download/node6/node.tar.gz
echo '' > $HOME/azure-pipelines-task-lib/_download/node6.completed

- name: 'Hack: manual download of node6 (windows)'
rm -rf $HOME/azure-pipelines-task-lib/_download/node20
mkdir -p $HOME/azure-pipelines-task-lib/_download/node20
curl https://nodejs.org/dist/v20.13.1/node-v20.13.1-darwin-x64.tar.gz -o $HOME/azure-pipelines-task-lib/_download/node20/node.tar.gz
tar xz -C $HOME/azure-pipelines-task-lib/_download/node20 -f $HOME/azure-pipelines-task-lib/_download/node20/node.tar.gz
echo '' > $HOME/azure-pipelines-task-lib/_download/node20.completed

rm -rf $HOME/azure-pipelines-task-lib/_download/node24
mkdir -p $HOME/azure-pipelines-task-lib/_download/node24
curl https://nodejs.org/dist/v24.10.0/node-v24.10.0-darwin-x64.tar.gz -o $HOME/azure-pipelines-task-lib/_download/node24/node.tar.gz
tar xz -C $HOME/azure-pipelines-task-lib/_download/node24 -f $HOME/azure-pipelines-task-lib/_download/node24/node.tar.gz
echo '' > $HOME/azure-pipelines-task-lib/_download/node24.completed

- name: 'Hack: manual download of node (windows)'
if: runner.os == 'Windows'
shell: pwsh
run: |
mkdir $env:RUNNER_TEMP/node6 > $null
curl https://nodejs.org/dist/v6.17.1/win-x64/node.exe -o $env:RUNNER_TEMP/node6/node.exe
mkdir $env:USERPROFILE/azure-pipelines-task-lib/_download/node6 > $null

curl https://nodejs.org/dist/v6.17.1/win-x64/node.exe -o $env:RUNNER_TEMP/node6/node.exe
cp $env:RUNNER_TEMP/node6/node.exe $env:USERPROFILE/azure-pipelines-task-lib/_download/node6

curl https://nodejs.org/dist/v6.17.1/win-x64/node.lib -o $env:RUNNER_TEMP/node6/node.lib
cp $env:RUNNER_TEMP/node6/node.lib $env:USERPROFILE/azure-pipelines-task-lib/_download/node6

echo '' > $env:USERPROFILE/azure-pipelines-task-lib/_download/node6.completed

- name: Setup nodejs 20.x
uses: actions/setup-node@v4
- name: Setup nodejs 24
uses: actions/setup-node@v6
with:
node-version: 20.x
node-version: 24

- name: Install dependencies
run: |
Expand All @@ -105,6 +122,7 @@ jobs:
npm --prefix tasks/ReplaceTokensV4 ci
npm --prefix tasks/ReplaceTokensV5 ci
npm --prefix tasks/ReplaceTokensV6 ci
npm --prefix tasks/ReplaceTokensV7 ci

- name: Test
run: npm run test
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# Changelog
## 6.0.0
Task 7.0.0
- **Breaking changes**: Remove Node 16 support.
- Add Node 24 support ([#90](https://github.com/qetza/replacetokens-task/issues/90)).

## 5.3.0
Task 6.3.1
- Fix "name not supplied" on empty token ([#88](https://github.com/qetza/replacetokens-task/issues/88)).
Expand Down
56 changes: 6 additions & 50 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,57 +6,13 @@ This Azure Pipelines task replaces tokens in text based files with variable valu
## What's new
Please refer to the [release page](https://github.com/qetza/replacetokens-task/releases/latest) for the latest release notes.

## Breaking changes in v6
The task was completely rewritten to use the npm package [@qetza/replacetokens](https://www.npmjs.com/package/@qetza/replacetokens) and be more similar with the new [ReplaceTokens GitHub Actions](https://github.com/marketplace/actions/replacetokens):
- support only node 16 (mininum agent version 2.206.1)
- renamed input _targetFiles_ to _sources_
- migrated to [fast-glob](https://github.com/mrmlnc/fast-glob) for glob patterns causing syntax changes (must use forward slash (`/`) for directory separator whatever the OS)
- removed support for comma-separated paths in _targetFiles_
- renamed _encoding_ value `win1252` to `windows1252`
- renamed _escapeType_ to _escape_
- renamed _escapeType_ value `none` to `off`
- merged inputs _variableFiles_ and _inlineVariables_ in _additionalVariables_
- renamed input _variableSeparator_ to _separator_
- renamed input _enableRecursion_ to _recursive_
- renamed input _rootDirectory_ to _root_
- renamed _tokenPattern_ value `rm` to `doubleunderscores`
- renamed input _writeBOM_ to _addBOM_
- changed _writeBOM_ default value to `false`
- renamed input _verbosity_ to _logLevel_
- renamed _verbosity_ value `detailed` to `debug`
- renamed _verbosity_ value `normal` to `info`
- removed _verbosity_ value `off` (see new supported values for replacement)
- renamed input _actionOnMissing_ to _missingVarLog_
- renamed _actionOnMissing_ value `continue` to `off`
- renamed _actionOnMissing_ value `fail` to `error`
- replaced _keepToken_ with _missingVarAction_ with value `keep`
- renamed input _actionOnNoFiles_ to _ifNoFilesFound_
- renamed _actionOnNoFiles_ value `continue` to `ignore`
- renamed _actionOnNoFiles_ value `fail` to `error`
- renamed input _enableTransforms_ to _transforms_
- renamed transform `noescape` to `raw`
- renamed input _transformPrefix_ to _transformsPrefix_
- renamed input _transformSuffix_ to _transformsSuffix_
- removed input _useLegacyPattern_
- removed input _useLegacyEmptyFeature_
- replaced input _useDefaultValue_ with _missingVarAction_ with value `replace`
- removed input _emptyValue_
- renamed input _defaultValue_ to _missingVarDefault_
- removed input _enableTelemetry_ to _telemetryOptout_ and inverse meaning
- renamed output _tokenReplacedCount_ to _replaced_
- renamed output _tokenFoundCount_ to _tokens_
- renamed output _fileProcessedCount_ to _files_
- renamed output _transformExecutedCount_ to _transforms_
- renamed output _defaultValueCount_ to _defaults_

You can find some documentation to help migrate here: [Migrate from v5 to v6](https://github.com/qetza/replacetokens-task/discussions/34)

If you are migrating from **v3 to v6** make sure to read this documentation first: [Migrate from v3 to v5](https://github.com/qetza/replacetokens-task/discussions/33)
## Breaking changes in v7
Remove Node 16 support.

## Usage
### Inputs
```yaml
- task: qetza.replacetokens.replacetokens-task.replacetokens@6
- task: qetza.replacetokens.replacetokens-task.replacetokens@7
inputs:
# A multiline list of files to replace tokens in.
# Each line supports:
Expand Down Expand Up @@ -297,7 +253,7 @@ If you are migrating from **v3 to v6** make sure to read this documentation firs
## Examples
### Multiple target files and opt out of sending telemetry data
```yaml
- task: qetza.replacetokens.replacetokens-task.replacetokens@6
- task: qetza.replacetokens.replacetokens-task.replacetokens@7
inputs:
telemetryOptout: true
sources: |
Expand All @@ -307,7 +263,7 @@ If you are migrating from **v3 to v6** make sure to read this documentation firs

### Additional variables
```yaml
- task: qetza.replacetokens.replacetokens-task.replacetokens@6
- task: qetza.replacetokens.replacetokens-task.replacetokens@7
inputs:
sources: '**/*.json'
additionalVariables: |
Expand All @@ -320,7 +276,7 @@ If you are migrating from **v3 to v6** make sure to read this documentation firs
### Access outputs
```yaml
steps:
- task: qetza.replacetokens.replacetokens-task.replacetokens@6
- task: qetza.replacetokens.replacetokens-task.replacetokens@7
name: replaceTokens
inputs:
sources: '**/*.json'
Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,26 @@
"url": "git+https://github.com/qetza/replacetokens-task.git"
},
"scripts": {
"build": "npm run build:v3 && npm run build:v4 && npm run build:v5 && npm run build:v6",
"build": "npm run build:v3 && npm run build:v4 && npm run build:v5 && npm run build:v6 && npm run build:v7",
"build:v3": "tsc --project tasks/ReplaceTokensV3/tsconfig.json",
"build:v4": "tsc --project tasks/ReplaceTokensV4/tsconfig.json",
"build:v5": "tsc --project tasks/ReplaceTokensV5/tsconfig.json",
"build:v6": "tsc --project tasks/ReplaceTokensV6/tsconfig.json",
"test": "npm run build && mocha tasks/**/tests/L0.js",
"build:v7": "tsc --project tasks/ReplaceTokensV7/tsconfig.json",
"test": "npm run test:v3 && npm run test:v4 && npm run test:v5 && npm run test:v6 && npm run test:v7",
"test:v3": "npm run build:v3 && mocha tasks/ReplaceTokensV3/dist/tests/L0.js",
"test:v4": "npm run build:v4 && mocha tasks/ReplaceTokensV4/dist/tests/L0.js",
"test:v5": "npm run build:v5 && mocha tasks/ReplaceTokensV5/dist/tests/L0.js",
"test:v6": "npm run build:v6 && mocha tasks/ReplaceTokensV6/dist/tests/L0.js",
"test:v7": "npm run build:v7 && mocha tasks/ReplaceTokensV7/dist/tests/L0.js",
"package": "node scripts/package.js",
"package:public": "node scripts/package.js --public",
"format": "npm run format:v3 && npm run format:v4 && npm run format:v5 && npm run format:v6",
"format": "npm run format:v3 && npm run format:v4 && npm run format:v5 && npm run format:v6 && npm run format:v7",
"format:v3": "prettier --write tasks/ReplaceTokensV3/**/*.ts",
"format:v4": "prettier --write tasks/ReplaceTokensV4/**/*.ts",
"format:v5": "prettier --write tasks/ReplaceTokensV5/**/*.ts",
"format:v6": "prettier --write tasks/ReplaceTokensV6/**/*.ts",
"format:v7": "prettier --write tasks/ReplaceTokensV7/**/*.ts",
"format:check": "prettier --check **/*.ts"
},
"devDependencies": {
Expand All @@ -49,6 +52,6 @@
"semver": "^7.6.0",
"shelljs": "^0.8.5",
"tfx-cli": "^0.21.0",
"typescript": "^5.1.6"
"typescript": "5.7.2"
}
}
2 changes: 1 addition & 1 deletion scripts/package.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ var generateVersion = function (major) {
}

// globals
var versions = ['3','4','5','6'];
var versions = ['3','4','5','6', '7'];

// ensure clean output
console.log('clean:');
Expand Down
37 changes: 28 additions & 9 deletions tasks/ReplaceTokensV5/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tasks/ReplaceTokensV5/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"@types/chai": "^4.3.12",
"@types/js-yaml": "^4.0.9",
"@types/mocha": "^10.0.6",
"@types/node": "^20.3.1",
"@types/node": "24.10.0",
"chai": "^4.4.1"
}
}
4 changes: 2 additions & 2 deletions tasks/ReplaceTokensV5/tests/L0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const data = path.join(__dirname, '../../tests/_data');
const tmp = path.join(__dirname, '_tmp');

describe('ReplaceTokens v5 L0 suite', function () {
this.timeout(10000);
this.timeout(5000);

function runValidation(validator: () => void, tr: ttm.MockTestRunner) {
try {
Expand Down Expand Up @@ -100,7 +100,7 @@ describe('ReplaceTokens v5 L0 suite', function () {
runValidation(() => {
tr.stdout.should.not.include('sent usage telemetry:');
}, tr);
});
}).timeout(60000);

it('should not call telemetry when disabled by REPLACETOKENS_DISABLE_TELEMETRY', async () => {
// arrange
Expand Down
Loading